﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Windows.Forms;

namespace BaiTap1
{
    public partial class frm_TimNhanVien : Form
    {
        public int _ma_nhan_vien;
        public bool _from_other_form;
        public frm_TimNhanVien()
        {
            InitializeComponent();
            LoadData();
            Binding();
        }
        public void LoadData()
        {
            nhanVienDTOBindingSource.DataSource = NhanVien_DAO.SelectAll();
        }
        public void Binding()
        { 

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void NhanVien_DTODataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int index = e.RowIndex;
            if (_from_other_form && index >= 0)
            {
                object obj = NhanVien_DTODataGridView[0, index].Value;
                if (obj != null)
                {
                    _ma_nhan_vien = (int)obj;
                    this.Close();
                }
            }
        }
    }
}
